//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//   PACKAGE   : dcf
//   FILE      : IService.java
//   INTERFACE : IService
//   DATE      : 2006-04-01
//   
//   DESCRIPTION
//   The IService interface represents a service in the system. Operations are defined that enable messages
//   to be sent via the service (to individual enpoints as well as in a broadcast manner) and to manage the 
//   service. 
//   
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//   Copyright (c) 2006 by Hal Smith
//
//   Permission is hereby granted, free of charge, to any person obtaining a copy of this source code 
//   (the "Code")to deal with the Code without restriction, including without limitation the rights to use, copy,
//   modify, merge, publish and distribute the Code, and to permit persons to whom the Code is furnished to do 
//   so, subject to the following conditions:
//
//   The above copyright notice and this permission notice shall be included in all copies or substantial 
//   portions of the Software.
//   
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//   VERSION HISTORY
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

package dcf;

import java.util.Vector;


public interface IService {

	// This enumeration defines the types of service that can be defined.
	// 
	//    SUBSCRIBER - The service is a user of a published service (i.e., client).
	//
	//    PUBLISHER  - The service is a provider to subscribers (i.e., server).
	//
	public enum ServiceType {SUBSCRIBER, 
                             PUBLISHER};
        
	
    // This operation returns the name of the service. There are no exceptions thrown by this operation.
    //
    public  String getServiceName();
	 
	
    // This operation returns the service type. There are no exceptions thrown by this operation.
    //
    public ServiceType getServiceType();
	 

	// This operation returns the number of endpoints currently bound. There are no exceptions thrown
    // by this operation.
	//
	public int getEndpointCount();
	
	
	// This operation returns true if there is at least one remote endpoint attached to this service and
	// false otherwise. There are no exceptions thrown by this operation.
	//
	public boolean isBound();
	
	
    // This operation sends a message to all remote endpoints. If the message is sent successfully, the
    // operation returns "true". If an error occurs while sending the message, the operation returns false
    // and an error is logged. Note that because "false" is returned does not mean that the message was 
    // not sent, only that an error occured. There are no excpetions thrown by this operation.
    //
	public boolean send(Message message);
	
	
    // This operation sends a message to the specified endpoint. If the message is sent successfully, the
    // operation returns "true". If an error occurs while sending the message, the operation returns false
    // and an error is logged. Note that because "false" is returned does not mean that the message was 
    // not sent, only that an error occured. There are no excpetions thrown by this operation.
    //
	public boolean sendTo(Endpoint remoteEndpoint, Message message);
	
	
	// This operation returns a list of all remote endpoints currently associted to this service. There are no
	// exceptions thrown by this operation.
	//
	public Vector<Endpoint> getRemoteEndpoints();

	
} // IService
